package com.pig4cloud.pig.order.controller;


import com.pig4cloud.pig.admin.api.entity.SysUser;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.security.util.SecurityUtils;
import com.pig4cloud.pig.order.api.dto.FollowRecord;
import com.pig4cloud.pig.order.service.FollowService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/follow")
@RequiredArgsConstructor
@Tag(description = "follow",name="跟进页面")
public class FollowController {
	private final FollowService followService;
	// 获取跟进记录
	@GetMapping("/{orderId}")
	public R<List<FollowRecord>> getFollowRecords(@PathVariable Long orderId) {
		List<FollowRecord> records = followService.getByOrderId(orderId);
		return R.ok(records);
	}

	// 发布跟进内容
	@PostMapping("/publish")
	public R publishFollow(@RequestBody FollowRecord followRecord) {
		int result=followService.insert(followRecord);
		//获取当前用户
		return result>0 ?R.ok() : R.failed("发布失败");
	}
}
